//
//  UserMeansViewController.m
//  QuickCure
//
//  Created by 马太行 on 16/9/14.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "UserMeansViewController.h"


#import "UserMeansTableViewCell.h"
@interface UserMeansViewController ()<UITableViewDelegate,UITableViewDataSource,UITextViewDelegate>

@end

@implementation UserMeansViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.'
    
    
    
    //使用tablevView
    UITableView *UserTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 375, 667)style:UITableViewStyleGrouped];
    
    UserTableView.backgroundView =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 375, 667)];
    
    UserTableView.backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backview.jpg"]];
    
    //行高
    UserTableView.rowHeight = 45;
    
    //添加
    [self.view addSubview:UserTableView];
    
    //设置代理
    UserTableView.delegate = self;
    UserTableView.dataSource = self;

    
    [self setdownview];
}

- (void)setdownview
{
    UIView *downview = [[UIView alloc]initWithFrame:CGRectMake(0,555, 375, 50)];
    
    downview.backgroundColor = [UIColor whiteColor];
    
    UIButton *editorBtn =[[UIButton alloc]initWithFrame:CGRectMake(100, 5, 175, 40)];
    
    [editorBtn setBackgroundImage:[UIImage imageNamed:@"nav"] forState:UIControlStateNormal];

     [editorBtn setTitle:@"修改资料" forState:UIControlStateNormal];

    [downview addSubview:editorBtn];
 
    
    [self.view addSubview:downview];
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    //一个头view上面放 一个头像
    UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 375, 200)];
    
    view1.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.5];
    
   
    
    UIImageView *imageview = [[UIImageView alloc]initWithFrame:CGRectMake(40, 450, 80, 80)];
    
    
    imageview.image = [UIImage imageNamed:@"heima"];
    
    
    imageview.layer.cornerRadius = 35;
    imageview.layer.masksToBounds = YES;
    [view1 addSubview:imageview];
    
    UILabel *namelabel = [[UILabel alloc]initWithFrame:CGRectMake(140, 460, 90, 40)];
    
    namelabel.text = @"黑马name";
    
    [view1 addSubview:namelabel];
    
    return view1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    
    //头高
    return 580;
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    //返回组
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    //返回行
    
    return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    //加载cell
    UserMeansTableViewCell *cell = [[UserMeansTableViewCell alloc]initWithUserMeans:indexPath];
    
    
    return cell;
}


- (void)dealloc{
    
    NSLog(@"hahah");
}






@end
